package com.wangyadong.hobby.front.model;

import org.springframework.context.SmartLifecycle;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MySecondLifeCycle implements SmartLifecycle {

    @Override
    public boolean isAutoStartup() {
        return true;
    }

    @Override
    public void stop(Runnable runnable) {
        System.out.println("stop MySecondLifeCycle runnable");
        new Thread(runnable).start();
    }

    @Override
    public void start() {
        System.out.println("start MySecondLifeCycle");
    }

    @Override
    public void stop() {
        System.out.println("stop MySecondLifeCycle");
    }

    @Override
    public boolean isRunning() {
        return true;
    }

    @Override
    public int getPhase() {
        System.out.println(" second getPhase ");
        return 1;
    }
}
